const mongoose = require("mongoose");
//车辆信息数据库
const schema = new mongoose.Schema(
  {
    name: { type: String },
    icon: { type: String },
    age: { type: String },
    milage: { type: String },
    TransmissionType: { type: String },
    price: { type: String },

    detailPics: [
      {
        icon: { type: String },
        name: { type: String },
        description: { type: String },
      },
    ],

    // 绑定用户
    userId: { type: mongoose.SchemaTypes.ObjectId, ref: "User" },
    // 绑定店铺
    shopId: { type: mongoose.SchemaTypes.ObjectId, ref: "Shop" },

    // 其他信息
    brand: { type: mongoose.SchemaTypes.ObjectId, ref: "Category" },
    carModel: { type: mongoose.SchemaTypes.ObjectId, ref: "Category" },
    color: { type: mongoose.SchemaTypes.ObjectId, ref: "Category" },
    fuelType: { type: mongoose.SchemaTypes.ObjectId, ref: "Category" },
  },
  {
    timestamps: true,
  }
);

module.exports = mongoose.model("Car", schema);
